{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "papermill": {
     "duration": 0.014628,
     "end_time": "2020-03-26T01:15:04.871918",
     "exception": false,
     "start_time": "2020-03-26T01:15:04.857290",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "# Visualizing The Total Number of Outstanding Cases\n",
    "> Visualizing Total Number of Outstanding Cases by Geographic Area.\n",
    "\n",
    "- comments: true\n",
    "- author: Adrian Turcato\n",
    "- categories: [growth, compare, interactive, d3]\n",
    "- hide: false\n",
    "- image: images/covid-outstanding-cases.png\n",
    "- permalink: /outstanding_cases/"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "papermill": {
     "duration": 0.010828,
     "end_time": "2020-03-26T01:15:04.894460",
     "exception": false,
     "start_time": "2020-03-26T01:15:04.883632",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "## Outstanding Cases by Geography\n",
    "\n",
    "Number of outstanding cases, i.e. number of individuals who are still currently ill. The color of the country reflects the reported case fatality rate (CFR), these rates do not reflect the true fatality rate of the virus but are heavily affected by the amount of testing which is performed in the country.\n",
    "\n",
    "\n",
    "> Tip: Click the buttons to toggle between geographies, or to change the scale. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "papermill": {
     "duration": 0.345339,
     "end_time": "2020-03-26T01:15:05.250736",
     "exception": false,
     "start_time": "2020-03-26T01:15:04.905397",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "from IPython.display import HTML, Javascript, display\n",
    "from string import Template\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "papermill": {
     "duration": 0.031187,
     "end_time": "2020-03-26T01:15:05.293094",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.261907",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "require.config({paths: {d3: 'https://d3js.org/d3.v2.min.js'}});"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#hide\n",
    "display(Javascript(\"require.config({paths: {d3: 'https://d3js.org/d3.v2.min.js'}});\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "papermill": {
     "duration": 0.026154,
     "end_time": "2020-03-26T01:15:05.331021",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.304867",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "def get_frame(name):\n",
    "    url = (\n",
    "        'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/'\n",
    "        f'csse_covid_19_time_series/time_series_covid19_{name}_global.csv')\n",
    "    df = pd.read_csv(url)\n",
    "    return df\n",
    "\n",
    "def flatten(df):\n",
    "    array = []\n",
    "    d = df.to_dict()\n",
    "    for v in d.items():\n",
    "        day = v[0]\n",
    "        for c in v[1].items():\n",
    "            country = c[0]\n",
    "            value = c[1]\n",
    "            array.append({\"key\":country,\"value\":value,\"date\":day})\n",
    "    return array\n",
    "\n",
    "def combine(cx,dx,rx):\n",
    "    all = []\n",
    "    for i, v in enumerate(cx):\n",
    "        v['confirmed'] = v['value']\n",
    "        v['deaths'] = dx[i]['value']\n",
    "        v['recovered'] = rx[i]['value']\n",
    "        v['value'] = v['value'] - dx[i]['value'] - rx[i]['value']\n",
    "        if v['value'] < 0:\n",
    "            print(\"-1 error:\", v['value'], v['confirmed'], dx[i]['value'], rx[i]['value'])\n",
    "            v['value'] = 0\n",
    "        fr = 0\n",
    "        if rx[i]['value'] + dx[i]['value'] + v['value'] > 0:\n",
    "            fr = dx[i]['value'] / (rx[i]['value'] + dx[i]['value'] + v['value'])\n",
    "        v['fatality'] = fr\n",
    "        all.append(v)\n",
    "    return all;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "papermill": {
     "duration": 0.040673,
     "end_time": "2020-03-26T01:15:05.383130",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.342457",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "def extractGlobal(df):\n",
    "    df = df.drop(columns=['Province/State', 'Lat', 'Long'])\n",
    "    df = df.groupby('Country/Region').sum()\n",
    "    return df\n",
    "\n",
    "abbreviations=[{\"name\":\"Alabama\",\"abbreviation\":\"AL\"},{\"name\":\"Alaska\",\"abbreviation\":\"AK\"},{\"name\":\"American Samoa\",\"abbreviation\":\"AS\"},{\"name\":\"Arizona\",\"abbreviation\":\"AZ\"},{\"name\":\"Arkansas\",\"abbreviation\":\"AR\"},{\"name\":\"California\",\"abbreviation\":\"CA\"},{\"name\":\"Colorado\",\"abbreviation\":\"CO\"},{\"name\":\"Connecticut\",\"abbreviation\":\"CT\"},{\"name\":\"Delaware\",\"abbreviation\":\"DE\"},{\"name\":\"District of Columbia\",\"abbreviation\":\"D.C.\"},{\"name\":\"Federated States Of Micronesia\",\"abbreviation\":\"FM\"},{\"name\":\"Florida\",\"abbreviation\":\"FL\"},{\"name\":\"Georgia\",\"abbreviation\":\"GA\"},{\"name\":\"Guam\",\"abbreviation\":\"GU\"},{\"name\":\"Hawaii\",\"abbreviation\":\"HI\"},{\"name\":\"Idaho\",\"abbreviation\":\"ID\"},{\"name\":\"Illinois\",\"abbreviation\":\"IL\"},{\"name\":\"Indiana\",\"abbreviation\":\"IN\"},{\"name\":\"Iowa\",\"abbreviation\":\"IA\"},{\"name\":\"Kansas\",\"abbreviation\":\"KS\"},{\"name\":\"Kentucky\",\"abbreviation\":\"KY\"},{\"name\":\"Louisiana\",\"abbreviation\":\"LA\"},{\"name\":\"Maine\",\"abbreviation\":\"ME\"},{\"name\":\"Marshall Islands\",\"abbreviation\":\"MH\"},{\"name\":\"Maryland\",\"abbreviation\":\"MD\"},{\"name\":\"Massachusetts\",\"abbreviation\":\"MA\"},{\"name\":\"Michigan\",\"abbreviation\":\"MI\"},{\"name\":\"Minnesota\",\"abbreviation\":\"MN\"},{\"name\":\"Mississippi\",\"abbreviation\":\"MS\"},{\"name\":\"Missouri\",\"abbreviation\":\"MO\"},{\"name\":\"Montana\",\"abbreviation\":\"MT\"},{\"name\":\"Nebraska\",\"abbreviation\":\"NE\"},{\"name\":\"Nevada\",\"abbreviation\":\"NV\"},{\"name\":\"New Hampshire\",\"abbreviation\":\"NH\"},{\"name\":\"New Jersey\",\"abbreviation\":\"NJ\"},{\"name\":\"New Mexico\",\"abbreviation\":\"NM\"},{\"name\":\"New York\",\"abbreviation\":\"NY\"},{\"name\":\"North Carolina\",\"abbreviation\":\"NC\"},{\"name\":\"North Dakota\",\"abbreviation\":\"ND\"},{\"name\":\"Northern Mariana Islands\",\"abbreviation\":\"MP\"},{\"name\":\"Ohio\",\"abbreviation\":\"OH\"},{\"name\":\"Oklahoma\",\"abbreviation\":\"OK\"},{\"name\":\"Oregon\",\"abbreviation\":\"OR\"},{\"name\":\"Palau\",\"abbreviation\":\"PW\"},{\"name\":\"Pennsylvania\",\"abbreviation\":\"PA\"},{\"name\":\"Puerto Rico\",\"abbreviation\":\"PR\"},{\"name\":\"Rhode Island\",\"abbreviation\":\"RI\"},{\"name\":\"South Carolina\",\"abbreviation\":\"SC\"},{\"name\":\"South Dakota\",\"abbreviation\":\"SD\"},{\"name\":\"Tennessee\",\"abbreviation\":\"TN\"},{\"name\":\"Texas\",\"abbreviation\":\"TX\"},{\"name\":\"Utah\",\"abbreviation\":\"UT\"},{\"name\":\"Vermont\",\"abbreviation\":\"VT\"},{\"name\":\"Virgin Islands\",\"abbreviation\":\"VI\"},{\"name\":\"Virginia\",\"abbreviation\":\"VA\"},{\"name\":\"Washington\",\"abbreviation\":\"WA\"},{\"name\":\"West Virginia\",\"abbreviation\":\"WV\"},{\"name\":\"Wisconsin\",\"abbreviation\":\"WI\"},{\"name\":\"Wyoming\",\"abbreviation\":\"WY\"}]\n",
    "\n",
    "def replaceStates(y):\n",
    "    x = y.split(\",\")\n",
    "    if len(x) > 1:\n",
    "        for i, e in enumerate(abbreviations):\n",
    "            if e['abbreviation'].strip() == x[1].strip():\n",
    "                return e['name']\n",
    "    if y == \"United States Virgin Islands\":\n",
    "        return \"Virgin Islands\"\n",
    "    return y\n",
    "\n",
    "def extractUSA(df):\n",
    "    df = df[df['Country/Region'] == \"US\"]\n",
    "    df = df.drop(columns=['Country/Region', 'Lat', 'Long'])\n",
    "    df = df[~df['Province/State'].isin([\"US\"])]\n",
    "    df['Province/State'] = df['Province/State'].apply(lambda x: replaceStates(x))\n",
    "    df = df.groupby('Province/State').sum()\n",
    "    dates = df.columns[:32].values\n",
    "    df = df.drop(columns=dates)\n",
    "    return df\n",
    "\n",
    "def extractCanada(df):\n",
    "    df = df[df['Country/Region'] == \"Canada\"]\n",
    "    df = df.drop(columns=['Country/Region', 'Lat', 'Long'])\n",
    "    df = df.groupby('Province/State').sum()\n",
    "    dates = df.columns[:32].values\n",
    "    df = df.drop(columns=dates)\n",
    "    return df\n",
    "\n",
    "eu = ['Germany','Finland','Italy','Spain','Belgium','Switzerland','Austria','Greece','Norway','Romania','Estonia','San Marino','Belarus','Iceland','Lithuania','Ireland','Luxembourg','Monaco','Portugal','Andorra','Latvia','Ukraine' 'Hungary','Liechtenstein','Poland','Bosnia and Herzegovina','Slovenia','Serbia','Slovakia','Bulgaria','Albania','Holy See','France','Denmark','Czechia','Moldova','United Kingdom','Kosovo','Netherlands','Montenegro']\n",
    "\n",
    "def extractEurope(df):\n",
    "    df = df[df['Country/Region'].isin(eu)]\n",
    "    df = df.drop(columns=['Province/State', 'Lat', 'Long'])\n",
    "    df = df.groupby('Country/Region').sum()\n",
    "    datesEU = df.columns[:32].values\n",
    "    df = df.drop(columns=datesEU)\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "papermill": {
     "duration": 0.089159,
     "end_time": "2020-03-26T01:15:05.483776",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.394617",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "confirmedRaw = get_frame('confirmed')\n",
    "deathsRaw = get_frame('deaths')\n",
    "recoveredRaw = get_frame('recovered')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "papermill": {
     "duration": 0.053227,
     "end_time": "2020-03-26T01:15:05.549200",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.495973",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>1/22/20</th>\n",
       "      <th>1/23/20</th>\n",
       "      <th>1/24/20</th>\n",
       "      <th>1/25/20</th>\n",
       "      <th>1/26/20</th>\n",
       "      <th>1/27/20</th>\n",
       "      <th>1/28/20</th>\n",
       "      <th>1/29/20</th>\n",
       "      <th>1/30/20</th>\n",
       "      <th>1/31/20</th>\n",
       "      <th>...</th>\n",
       "      <th>3/18/20</th>\n",
       "      <th>3/19/20</th>\n",
       "      <th>3/20/20</th>\n",
       "      <th>3/21/20</th>\n",
       "      <th>3/22/20</th>\n",
       "      <th>3/23/20</th>\n",
       "      <th>3/24/20</th>\n",
       "      <th>3/25/20</th>\n",
       "      <th>3/26/20</th>\n",
       "      <th>3/27/20</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country/Region</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>22</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>24</td>\n",
       "      <td>40</td>\n",
       "      <td>40</td>\n",
       "      <td>74</td>\n",
       "      <td>84</td>\n",
       "      <td>94</td>\n",
       "      <td>110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>59</td>\n",
       "      <td>64</td>\n",
       "      <td>70</td>\n",
       "      <td>76</td>\n",
       "      <td>89</td>\n",
       "      <td>104</td>\n",
       "      <td>123</td>\n",
       "      <td>146</td>\n",
       "      <td>174</td>\n",
       "      <td>186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>74</td>\n",
       "      <td>87</td>\n",
       "      <td>90</td>\n",
       "      <td>139</td>\n",
       "      <td>201</td>\n",
       "      <td>230</td>\n",
       "      <td>264</td>\n",
       "      <td>302</td>\n",
       "      <td>367</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>39</td>\n",
       "      <td>53</td>\n",
       "      <td>75</td>\n",
       "      <td>88</td>\n",
       "      <td>113</td>\n",
       "      <td>133</td>\n",
       "      <td>164</td>\n",
       "      <td>188</td>\n",
       "      <td>224</td>\n",
       "      <td>267</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Angola</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Venezuela</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>36</td>\n",
       "      <td>42</td>\n",
       "      <td>42</td>\n",
       "      <td>70</td>\n",
       "      <td>70</td>\n",
       "      <td>77</td>\n",
       "      <td>84</td>\n",
       "      <td>91</td>\n",
       "      <td>107</td>\n",
       "      <td>107</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Vietnam</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>75</td>\n",
       "      <td>85</td>\n",
       "      <td>91</td>\n",
       "      <td>94</td>\n",
       "      <td>113</td>\n",
       "      <td>123</td>\n",
       "      <td>134</td>\n",
       "      <td>141</td>\n",
       "      <td>153</td>\n",
       "      <td>163</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West Bank and Gaza</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>41</td>\n",
       "      <td>44</td>\n",
       "      <td>47</td>\n",
       "      <td>48</td>\n",
       "      <td>52</td>\n",
       "      <td>59</td>\n",
       "      <td>59</td>\n",
       "      <td>59</td>\n",
       "      <td>84</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>12</td>\n",
       "      <td>16</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zimbabwe</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>176 rows × 66 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                    1/22/20  1/23/20  1/24/20  1/25/20  1/26/20  1/27/20  \\\n",
       "Country/Region                                                             \n",
       "Afghanistan               0        0        0        0        0        0   \n",
       "Albania                   0        0        0        0        0        0   \n",
       "Algeria                   0        0        0        0        0        0   \n",
       "Andorra                   0        0        0        0        0        0   \n",
       "Angola                    0        0        0        0        0        0   \n",
       "...                     ...      ...      ...      ...      ...      ...   \n",
       "Venezuela                 0        0        0        0        0        0   \n",
       "Vietnam                   0        2        2        2        2        2   \n",
       "West Bank and Gaza        0        0        0        0        0        0   \n",
       "Zambia                    0        0        0        0        0        0   \n",
       "Zimbabwe                  0        0        0        0        0        0   \n",
       "\n",
       "                    1/28/20  1/29/20  1/30/20  1/31/20  ...  3/18/20  3/19/20  \\\n",
       "Country/Region                                          ...                     \n",
       "Afghanistan               0        0        0        0  ...       22       22   \n",
       "Albania                   0        0        0        0  ...       59       64   \n",
       "Algeria                   0        0        0        0  ...       74       87   \n",
       "Andorra                   0        0        0        0  ...       39       53   \n",
       "Angola                    0        0        0        0  ...        0        0   \n",
       "...                     ...      ...      ...      ...  ...      ...      ...   \n",
       "Venezuela                 0        0        0        0  ...       36       42   \n",
       "Vietnam                   2        2        2        2  ...       75       85   \n",
       "West Bank and Gaza        0        0        0        0  ...       41       44   \n",
       "Zambia                    0        0        0        0  ...        2        2   \n",
       "Zimbabwe                  0        0        0        0  ...        0        0   \n",
       "\n",
       "                    3/20/20  3/21/20  3/22/20  3/23/20  3/24/20  3/25/20  \\\n",
       "Country/Region                                                             \n",
       "Afghanistan              24       24       40       40       74       84   \n",
       "Albania                  70       76       89      104      123      146   \n",
       "Algeria                  90      139      201      230      264      302   \n",
       "Andorra                  75       88      113      133      164      188   \n",
       "Angola                    1        2        2        3        3        3   \n",
       "...                     ...      ...      ...      ...      ...      ...   \n",
       "Venezuela                42       70       70       77       84       91   \n",
       "Vietnam                  91       94      113      123      134      141   \n",
       "West Bank and Gaza       47       48       52       59       59       59   \n",
       "Zambia                    2        2        3        3        3       12   \n",
       "Zimbabwe                  1        3        3        3        3        3   \n",
       "\n",
       "                    3/26/20  3/27/20  \n",
       "Country/Region                        \n",
       "Afghanistan              94      110  \n",
       "Albania                 174      186  \n",
       "Algeria                 367      409  \n",
       "Andorra                 224      267  \n",
       "Angola                    4        4  \n",
       "...                     ...      ...  \n",
       "Venezuela               107      107  \n",
       "Vietnam                 153      163  \n",
       "West Bank and Gaza       84       91  \n",
       "Zambia                   16       22  \n",
       "Zimbabwe                  3        5  \n",
       "\n",
       "[176 rows x 66 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#hide\n",
    "extractGlobal(confirmedRaw)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "papermill": {
     "duration": 0.021657,
     "end_time": "2020-03-26T01:15:05.583169",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.561512",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "def prepData(extract,varname):\n",
    "    confirmed = extract(confirmedRaw)\n",
    "    c = flatten(confirmed)\n",
    "    recovered = extract(recoveredRaw)\n",
    "    r = flatten(recovered)\n",
    "    deaths = extract(deathsRaw)\n",
    "    d = flatten(deaths)\n",
    "    all = combine(c,d,r)\n",
    "    json_string = json.dumps(all)\n",
    "    \n",
    "    pre = \"var \" + varname + \" =\"\n",
    "    post = \";\" #\"; get\" + varname + \" = function (){ return \" + varname + \"};})();\"\n",
    "    script = pre + json_string + post\n",
    "    \n",
    "    return script"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "papermill": {
     "duration": 0.216316,
     "end_time": "2020-03-26T01:15:05.811625",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.595309",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "getGlobalDataJson = prepData(extractGlobal,\"globalData\")\n",
    "getUsaDataJson = prepData(extractUSA,\"usaData\")\n",
    "getCanadaDataJson = prepData(extractCanada,\"canadaData\")\n",
    "getEuropeDataJson = prepData(extractEurope,\"europeData\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "papermill": {
     "duration": 0.020338,
     "end_time": "2020-03-26T01:15:05.844898",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.824560",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "html_temp = Template('''\n",
    "    <script src=\"https://d3js.org/d3.v2.min.js\"></script>\n",
    "    <style scoped>\n",
    "        $css_text \n",
    "    </style>\n",
    "    <div id=\"streamgraph\">\n",
    "\t\t<div class=\"buttons\">\n",
    "\t\t\t<button onclick=\"toggleGlobal()\">Global</button>\n",
    "\t\t\t<button onclick=\"toggleEU()\">Europe</button>\n",
    "\t\t\t<button onclick=\"toggleUSA()\">USA</button>\n",
    "\t\t\t<button onclick=\"toggleCanada()\">Canada</button>\n",
    "\t\t</div>\n",
    "\t\t<button onclick=\"toggleScale()\" id=\"toggle\">Toggle Scale</button>\n",
    "\t\t<div class=\"chart\">\n",
    "\t\t</div>\n",
    "\t</div>\n",
    "    <script>\n",
    "        $getUSA\n",
    "        $getEU\n",
    "        $getGlobal\n",
    "        $getCanada\n",
    "        \n",
    "        $d3_script\n",
    "        \n",
    "    </script>\n",
    "''')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "papermill": {
     "duration": 0.020345,
     "end_time": "2020-03-26T01:15:05.878121",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.857776",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "css_text = '''\n",
    ".chart {\n",
    "  font: 10px sans-serif;\n",
    "  background: #fff;\n",
    "  height: 575px;\n",
    "}\n",
    "\n",
    "#tooltip {\n",
    "  font: 10px sans-serif;\n",
    "}\n",
    "\n",
    ".axis path, .axis line {\n",
    "  fill: none;\n",
    "  stroke: #000;\n",
    "  stroke-width: 1px;\n",
    "  shape-rendering: crispEdges;\n",
    "}\n",
    "\n",
    ".buttons {\n",
    "  font: 11px sans-serif;\n",
    "  position: relative;\n",
    "  left: 50px;\n",
    "  top: 10px;\n",
    "}\n",
    "\n",
    "#toggle {\n",
    "  font: 11px sans-serif;\n",
    "  position: relative;\n",
    "  left: 660px;\n",
    "  top: 10px;\n",
    "}'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "papermill": {
     "duration": 0.025758,
     "end_time": "2020-03-26T01:15:05.916467",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.890709",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "d3_script = '''\n",
    "    console.log(\"d3\",d3)\n",
    "    var margin, width, height;\n",
    "    var svg, tooltip, area, blank;\n",
    "    var y, x, yAxis, xAxis;\n",
    "\n",
    "    var data, layers, logScale;\n",
    "    var usaLayers, globalLayers, euLayers;\n",
    "    var dataClass, prevClass;\n",
    "\n",
    "    margin = {top: 20, right: 60, bottom: 100, left: 30};\n",
    "    width = 750 - margin.left - margin.right;\n",
    "    height = 550 - margin.top - margin.bottom;\n",
    "\n",
    "    svg = d3.select(\".chart\").append(\"svg\")\n",
    "        .attr(\"width\", width + margin.left + margin.right)\n",
    "        .attr(\"height\", height + margin.top + margin.bottom)\n",
    "        .append(\"g\")\n",
    "        .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n",
    "\n",
    "    var cs = d3.scale.linear()\n",
    "        .domain([0,0.5,1])\n",
    "        .interpolate(d3.interpolateRgb)\n",
    "        .range([d3.rgb('#cc0000'),d3.rgb(249, 247, 174),d3.rgb(0, 104, 55)]);\n",
    "\n",
    "    var format = d3.time.format(\"%m/%d/%y\");\n",
    "    function formatDate (d) {\n",
    "        d.date = format.parse(d.date);\n",
    "        d.value = +d.value;\n",
    "    } \n",
    "\n",
    "    // axis\n",
    "    x = d3.time.scale()\n",
    "        .range([0, width])\n",
    "        .clamp(true);\n",
    "\n",
    "    xAxis = d3.svg.axis()\n",
    "        .orient(\"bottom\")\n",
    "        .ticks(d3.time.weeks);\n",
    "        // .tickFormat(d3.time.format(\"%b %d\"));\n",
    "\n",
    "    svg.append(\"g\")\n",
    "        .attr(\"class\", \"x axis\")\n",
    "        .attr(\"transform\", \"translate(0,\" + height + \")\");\t\t\n",
    "\n",
    "    yAxis = d3.svg.axis()\n",
    "        .orient(\"right\") \n",
    "        .tickFormat(d3.format(\",\"));\n",
    "\n",
    "    svg.append(\"g\")\n",
    "        .attr(\"class\", \"y axis\")\n",
    "        .attr(\"transform\", \"translate(\" + width + \", 0)\");\n",
    "\n",
    "    // clipping paths\n",
    "    svg.append(\"defs\")\n",
    "        .append(\"clipPath\")\n",
    "        .attr(\"id\",\"clip\")\n",
    "        .append(\"rect\")\n",
    "        .attr(\"width\",width-3)\n",
    "        .attr(\"height\",height-10)\n",
    "        .attr(\"x\",0)\n",
    "        .attr(\"y\",0);\n",
    "\n",
    "    svg.append(\"text\")\n",
    "        .attr(\"text-anchor\", \"middle\") \n",
    "        .attr(\"transform\", \"translate(\"+ (width + margin.right*0.8) +\",\"+(height/2)+\")rotate(90)\")  \n",
    "        .text(\"Current Outstanding Cases\");\n",
    "\n",
    "    svg.append(\"text\")\n",
    "        .attr(\"text-anchor\", \"middle\")  \n",
    "        .attr(\"transform\", \"translate(\"+ (width/2) +\",\"+(height + 40)+\")\")  \n",
    "        .text(\"Date\");\n",
    "\n",
    "    area = d3.svg.area()\n",
    "        .interpolate(\"cardinal\")\n",
    "        .x(d => x(d.date));\n",
    "\n",
    "    blank = d3.svg.area()\n",
    "        .interpolate(\"cardinal\")\n",
    "        .x(d => x(d.date));\n",
    "\n",
    "    usaData.forEach(formatDate);\n",
    "    usaLayers = prepareData(usaData);\n",
    "\n",
    "    globalData.forEach(formatDate);\n",
    "    globalLayers = prepareData(globalData);\n",
    "\n",
    "    europeData.forEach(formatDate);\n",
    "    euLayers = prepareData(europeData);\n",
    "\n",
    "    canadaData.forEach(formatDate);\n",
    "    canadaLayers = prepareData(canadaData);\n",
    "\n",
    "    dataClass = \"globalData\";\n",
    "    prevClass = \"usaData\";\n",
    "\n",
    "    data = globalData;\n",
    "    layers = globalLayers;\n",
    "    logScale = true;\n",
    "\n",
    "    drawScale();\n",
    "    drawLegend();\n",
    "    draw();\n",
    "\n",
    "    toggleScale = function (){\n",
    "        logScale = !logScale;\n",
    "        drawScale();\n",
    "    }\n",
    "    toggleUSA = function(){\n",
    "        prevClass = dataClass;\n",
    "        dataClass = \"usaData\";\n",
    "\n",
    "        data = usaData;\n",
    "        layers = usaLayers;\n",
    "        drawScale();\n",
    "        draw();\n",
    "    }\n",
    "    toggleGlobal = function (){\n",
    "        prevClass = dataClass;\n",
    "        dataClass = \"globalData\";\n",
    "\n",
    "        data = globalData;\n",
    "        layers = globalLayers;\n",
    "        drawScale(); \n",
    "        draw();\n",
    "    }\n",
    "    toggleEU = function(){\n",
    "        prevClass = dataClass;\n",
    "        dataClass = \"europeData\";\n",
    "\n",
    "        data = europeData;\n",
    "        layers = euLayers;\n",
    "        drawScale();\n",
    "        draw();\n",
    "    }\n",
    "    toggleCanada = function(){\n",
    "        prevClass = dataClass;\n",
    "        dataClass = \"canadaData\";\n",
    "\n",
    "        data = canadaData;\n",
    "        layers = canadaLayers;\n",
    "        drawScale();\n",
    "        draw();\n",
    "    }\n",
    "    function drawScale(){\n",
    "        area.y0(d => {return y(d.y0 + 1)})\n",
    "            .y1(d => {return y(d.y0 + d.y + 1)});\n",
    "        blank.y0(d => height)\n",
    "            .y1(d => height);\n",
    "\n",
    "        var yExt = d3.extent(data, d => {return d.y0 + d.y});\n",
    "        var logMin = 1000;\n",
    "        if(dataClass == \"usaData\") logMin = 300;\n",
    "        if(dataClass == \"canadaData\") logMin = 10;\n",
    "        y = d3.scale.log()\n",
    "            .range([height-10, 0])\n",
    "            .domain([logMin,yExt[1]])\n",
    "            .clamp(true);\n",
    "        if(!logScale){\n",
    "            y = d3.scale.linear()\n",
    "                .range([height-10, 0])\n",
    "                .domain(yExt)\n",
    "                .clamp(true);\n",
    "        }\n",
    "        yAxis.scale(y);\n",
    "\n",
    "        x.domain(d3.extent(data, d => d.date));\n",
    "        xAxis.scale(x);\n",
    "\n",
    "        svg.selectAll(\".y\")\n",
    "            .transition(\"axis\")\n",
    "            .duration(1000)\n",
    "            .call(yAxis);\n",
    "\n",
    "        svg.selectAll(\".x\")\n",
    "            .transition(\"axis\")\n",
    "            .duration(1000)\n",
    "            .call(xAxis);\n",
    "            // .selectAll(\"text\")  \n",
    "            // .style(\"text-anchor\", \"end\")\n",
    "            // .attr(\"dx\", \"-.8em\")\n",
    "            // .attr(\"dy\", \".15em\")\n",
    "            // .attr(\"transform\", \"rotate(-65)\" );\n",
    "\n",
    "        svg.selectAll(\".layer\")\n",
    "            .transition(\"axis\")\n",
    "            .duration(1000)\n",
    "            .attr(\"d\", d => area(d.values))\t\n",
    "    }\n",
    "    function draw(){\n",
    "        var leaving = svg.selectAll(`.${prevClass}`);\n",
    "        leaving.transition(\"load\")\n",
    "            .duration(1000)\n",
    "            .attr(\"d\", d => blank(d.values))\n",
    "            .remove();\n",
    "\n",
    "        var countries = svg.selectAll(`.${dataClass}`)\n",
    "            .data(layers);\n",
    "\n",
    "        countries.enter()\n",
    "            .append(\"path\")\n",
    "            .attr(\"d\", d => blank(d.values))\n",
    "            .on(\"mousemove\", d => updateTooltip(d))\n",
    "            .on(\"mouseout\", function(d, i) {\n",
    "                tooltip.style(\"visibility\", \"hidden\");\n",
    "            })\n",
    "            .transition(\"load\")\n",
    "            .duration(1000)\n",
    "            .attr(\"d\", d => blank(d.values))\n",
    "            .attr(\"class\", `layer ${dataClass}`)\n",
    "            .attr(\"d\", d => area(d.values))\n",
    "            .attr(\"fill\", d => {return `url(#${d.gradient})`})\n",
    "            .attr(\"clip-path\",\"url(#clip)\")\n",
    "            .attr(\"opacity\", 1);\n",
    "    }\n",
    "    function drawLegend(){\n",
    "        var defs = svg.append(\"defs\");\n",
    "\n",
    "        var gradient = defs.append(\"linearGradient\")\n",
    "           .attr(\"id\", \"legend-grad\")\n",
    "           .attr(\"x1\", \"0%\")\n",
    "           .attr(\"x2\", \"100%\")\n",
    "           .attr(\"y1\", \"0%\")\n",
    "           .attr(\"y2\", \"0%\");\n",
    "\n",
    "        for(var i = 0; i <= 10; i++){\n",
    "            gradient.append(\"stop\")\n",
    "                .attr(\"offset\", `${i*10}%`)\n",
    "                .attr(\"stop-color\", cs(1-i/10)) // d3.interpolateRdYlGn(1-i/10))\n",
    "                .attr(\"stop-opacity\", 1);\n",
    "        }\n",
    "\n",
    "        var legend = svg.append(\"g\")\n",
    "            .attr(\"id\",\"legend\")\n",
    "            .attr(\"transform\", `translate(${(width/2)-150},${height+65})`)\n",
    "        legend.append(\"rect\")\n",
    "            .attr(\"width\",300)\n",
    "            .attr(\"height\",15)\n",
    "            .attr(\"fill\", \"url(#legend-grad)\");\n",
    "        legend.append(\"text\")\n",
    "            .attr(\"text-anchor\", \"end\") \n",
    "            .attr(\"transform\", \"translate(\"+ -10 +\",\"+10+\")\")  \n",
    "            .text(\"Case Fatality Rate (CFR)\");\n",
    "\n",
    "        var lScale = d3.scale.linear()\n",
    "            .range([0, 300])\n",
    "            .domain([0.0,0.09]);\n",
    "\n",
    "        var lAxis = d3.svg.axis()\n",
    "            .orient(\"bottom\") \n",
    "            .scale(lScale)\n",
    "            .tickSize(18,0)\n",
    "            .tickFormat(d3.format(\".1%\"));\n",
    "\n",
    "        var l2 = svg.append(\"g\")\n",
    "            .attr(\"class\", \"legend-axis axis\")\n",
    "            .attr(\"transform\", `translate(${(width/2)-150},${height+65})`)\n",
    "            .call(lAxis);\n",
    "\n",
    "        l2.selectAll(\"path\")\n",
    "            .remove();\n",
    "    }\n",
    "    function prepareData(data){\n",
    "        console.log(\"fn: prepareData\")\n",
    "        //manipulate data\n",
    "        var nest = d3.nest()\n",
    "            .key(function(d) { return d.key; });\n",
    "        var alphabetic = nest.entries(data);\n",
    "        var l = alphabetic.length;\n",
    "\n",
    "        //order data\n",
    "        for(var i = 0; i < l; i++){\n",
    "            var vals = alphabetic[i].values;\n",
    "            var lv = vals.length;\n",
    "            var current = vals[lv-1];\n",
    "            alphabetic[i].fatality = current.fatality;\n",
    "            alphabetic[i].current = current.value;\n",
    "            alphabetic[i].index = i\n",
    "        }\n",
    "        alphabetic.sort((a,b) => (a.current - b.current));\n",
    "\n",
    "        var stack = d3.layout.stack()\n",
    "          .offset(\"zero\")\n",
    "          .order(() => alphabetic.map(e => e.index))\n",
    "          .values(d => d.values)\n",
    "          .x(d => d.date)\n",
    "          .y(d => d.value);\n",
    "\n",
    "        //add color gradients\n",
    "        for(var i = 0; i < l; i++){\n",
    "            var name = alphabetic[i].key.replace(/\\s/g, '')\n",
    "            var id = `gradient-${name}`;\n",
    "            alphabetic[i].gradient = id;\n",
    "\n",
    "            var defs = svg.append(\"defs\");\n",
    "\n",
    "            var gradient = defs.append(\"linearGradient\")\n",
    "               .attr(\"id\", id)\n",
    "               .attr(\"x1\", \"0%\")\n",
    "               .attr(\"x2\", \"100%\")\n",
    "               .attr(\"y1\", \"0%\")\n",
    "               .attr(\"y2\", \"0%\");\n",
    "\n",
    "            var values = alphabetic[i].values;\n",
    "            var lv = alphabetic[i].values.length;\n",
    "\n",
    "            for(var j = 0; j < lv; j++){\n",
    "                var offset = `${Math.round(j*100/(lv-1))}%`;\n",
    "                var fr = values[j].fatality/0.09;\n",
    "                var col = cs(1-fr); //d3.interpolateRdYlGn(1-fr);\n",
    "\n",
    "                gradient.append(\"stop\")\n",
    "                    .attr(\"offset\", offset)\n",
    "                    .attr(\"stop-color\", col)\n",
    "                    .attr(\"stop-opacity\", 1);  \n",
    "            }\n",
    "        }\n",
    "\n",
    "        var layers = stack(nest.entries(data));\n",
    "        for(var i = 0; i < l; i++){\n",
    "            var name = layers[i].key.replace(/\\s/g, '')\n",
    "            var id = `gradient-${name}`;\n",
    "            layers[i].gradient = id;\n",
    "        }\n",
    "        return layers;\n",
    "    }\n",
    "    function updateTooltip(d){\n",
    "        current = d3.format(\",\")(d.values[d.values.length-1].value)\n",
    "        deaths = d3.format(\",\")(d.values[d.values.length-1].deaths)\n",
    "        recoveries = d3.format(\",\")(d.values[d.values.length-1].recovered)\n",
    "        fatality = d3.format(\".1%\")(d.values[d.values.length-1].fatality)\n",
    "        day = d3.time.format(\"%m/%d/%y\")(d.values[d.values.length-1].date)\n",
    "        \n",
    "        var n = d.key;\n",
    "\t\tif(n == \"Korea, South\") n = \"South Korea\";\n",
    "\t\tif(n == \"Taiwan*\") n = \"Taiwan\";\n",
    "\n",
    "        tooltip = svg.selectAll(\".tooltip\")\n",
    "            .data([n,day,`current cases: ${current}`,`deaths: ${deaths}`,`recoveries: ${recoveries}`,`CFR: ${fatality}`]);\n",
    "        tooltip.style(\"visibility\", \"visible\")\n",
    "            .text(d => d);\n",
    "        tooltip.enter()\n",
    "            .append(\"text\")\n",
    "            .attr(\"class\", \"tooltip\")\n",
    "            .attr(\"x\",\"0\")\n",
    "            .attr(\"y\",(d,i) => `${i}em`)\n",
    "            .attr(\"font-weight\", (d,i) => i == 0 ? \"bold\" : \"normal\")\n",
    "            .attr(\"opacity\",1)\n",
    "            .text(d => d);\n",
    "    }\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "papermill": {
     "duration": 0.02094,
     "end_time": "2020-03-26T01:15:05.950325",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.929385",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide\n",
    "html_text = html_temp.substitute({\n",
    "    'css_text':css_text\n",
    "    ,'d3_script':d3_script\n",
    "    ,\"getUSA\":getUsaDataJson\n",
    "    ,\"getEU\":getEuropeDataJson\n",
    "    ,\"getGlobal\":getGlobalDataJson\n",
    "    ,\"getCanada\":getCanadaDataJson\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "papermill": {
     "duration": 0.098876,
     "end_time": "2020-03-26T01:15:06.061616",
     "exception": false,
     "start_time": "2020-03-26T01:15:05.962740",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "#hide_input\n",
    "HTML(html_text)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "papermill": {
     "duration": 0.037259,
     "end_time": "2020-03-26T01:15:06.136563",
     "exception": false,
     "start_time": "2020-03-26T01:15:06.099304",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "This visualization was created by [Adrian Turcato](https://www.linkedin.com/in/adrian-turcato-9a543185/). Relevant sources are listed below: \n",
    "\n",
    "1. [2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE](https://systems.jhu.edu/research/public-health/ncov/) [GitHub repository](https://github.com/CSSEGISandData/COVID-19). \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "papermill": {
     "duration": 0.038453,
     "end_time": "2020-03-26T01:15:06.212973",
     "exception": false,
     "start_time": "2020-03-26T01:15:06.174520",
     "status": "completed"
    },
    "tags": []
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "visualization-curriculum-gF8wUgMm",
   "language": "python",
   "name": "visualization-curriculum-gf8wugmm"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  },
  "papermill": {
   "duration": 2.234654,
   "end_time": "2020-03-26T01:15:06.257953",
   "environment_variables": {},
   "exception": null,
   "input_path": "2020-03-23-cumulative-outstanding.ipynb",
   "output_path": "2020-03-23-cumulative-outstanding.ipynb",
   "parameters": {},
   "start_time": "2020-03-26T01:15:04.023299",
   "version": "2.0.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
